-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Clarify that hooks give you control over exit codes. #4680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a new "Hook exit codes" section to the Hooks documentation explaining that non-zero exit codes from before_hook/after_hook propagate to Terragrunt’s exit code, with an example. The section is inserted twice (duplicated). No code or public API changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
docs-starlight/src/content/docs/02-features/10-hooks.md (5)
232-236: Polish the “Hook exit codes” section: fix typos and tighten phrasing
- Replace “apply more control to” with “control”/“gain more control over.”
- Fix “after-hook” → “after_hook.”
- Remove the stray “the” and extra backtick.
- Avoid “unit” (undefined term here); use “configuration” (or “module/directory”) for clarity.
-Hooks allow you to apply more control to the exit code returned by the applicable underlying OpenTofu/Terraform command. If any `before_hook` or `after_hook` returns a non-zero exit code, the Terragrunt command you run against the unit will return a non-zero exit code. +Hooks let you control Terragrunt's exit code. If any `before_hook` or `after_hook` returns a non-zero exit code, the Terragrunt command will exit non-zero. -For example, suppose you run `terragrunt apply` on a given unit that has no `before_hook`, but has a non-empty `after-hook`. Because there is no `before_hook` defined, Terragrunt will first run `tofu apply`, and let's assume that succeeds and returns an exit code of `0`. Next, Terragrunt will run your `after_hook`. If that fails and returns an exit code of `1`, the ` the entire `terragrunt apply` operation will return an exit code of `1`, even though the underlying `tofu apply` succeeded. +For example, suppose you run `terragrunt apply` in a configuration that defines no `before_hook` but does define an `after_hook`. Terragrunt will first run `tofu apply` (assume it succeeds and returns `0`). Next, Terragrunt runs the `after_hook`. If that hook fails and returns `1`, the overall `terragrunt apply` command will also return `1`, even though `tofu apply` succeeded.
9-11: Capitalize “Terragrunt” and fix article usageMinor grammar/consistency nits.
-_Before Hooks_, _After Hooks_ and _Error Hooks_ are a feature of terragrunt that make it possible to define custom actions that will be called before/after running an `tofu`/`terraform` command. +_Before Hooks_, _After Hooks_, and _Error Hooks_ are a feature of Terragrunt that make it possible to define custom actions that will be called before/after running a `tofu`/`terraform` command.
132-136: Smoother wordingTighten the sentence and clarify “related to running OpenTofu/Terraform.”
-Hooks can be used to handle operations that need to happen, but are not directly related to the OpenTofu/Terraform. +Hooks can handle operations that need to happen but are not directly related to running OpenTofu/Terraform.
209-211: Subject–verb agreement and concision“Each hook … they are” mismatch; also simplify phrasing.
-You can have multiple before and after hooks. Each hook will execute in the order they are defined. +You can define multiple before and after hooks. Each hook executes in the order it is defined.
255-257: Fix possessive “its” and parallelismAlso capitalize the product name consistently in the link text if you prefer.
-The `.tflint.hcl` should exist in the same folder as `terragrunt.hcl` or one of it's parents. If Terragrunt can't find -a `.tflint.hcl` file, it won't execute tflint and return an error. All configurations should be in a `config` block in this -file, as per [Tflint's docs](https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/config.md). +The `.tflint.hcl` should exist in the same folder as `terragrunt.hcl` or one of its parents. If Terragrunt can't find +a `.tflint.hcl` file, it won't execute tflint and will return an error. All configurations should be in a `config` block in this +file, as per [TFLint's docs](https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/config.md).
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs-starlight/src/content/docs/02-features/10-hooks.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs-starlight/**/*.md*
⚙️ CodeRabbit Configuration File
Review the documentation for clarity, grammar, and spelling. Make sure that the documentation is easy to understand and follow. There is currently a migration underway from the Jekyll based documentation in
docsto the Starlight + Astro based documentation indocs-starlight. Make sure that thedocs-starlightdocumentation is accurate and up-to-date with thedocsdocumentation, and that any difference between them results in an improvement in thedocs-starlightdocumentation.
Files:
docs-starlight/src/content/docs/02-features/10-hooks.md
🪛 LanguageTool
docs-starlight/src/content/docs/02-features/10-hooks.md
[grammar] ~236-~236: There might be a mistake here.
Context: ...ls and returns an exit code of 1, the the entireterragrunt apply` operation wil...
(QB_NEW_EN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
- GitHub Check: build_no_proxy / Build (windows/386)
- GitHub Check: build_no_proxy / Build (darwin/arm64)
- GitHub Check: build_no_proxy / Build (windows/amd64)
- GitHub Check: build_no_proxy / Build (linux/arm64)
- GitHub Check: build_no_proxy / Build (darwin/amd64)
- GitHub Check: build_no_proxy / Build (linux/amd64)
- GitHub Check: build_no_proxy / Build (linux/386)
- GitHub Check: build / Build (darwin/amd64)
- GitHub Check: build / Build (linux/386)
- GitHub Check: build / Build (windows/386)
- GitHub Check: build / Build (darwin/arm64)
- GitHub Check: build / Build (linux/amd64)
- GitHub Check: build / Build (linux/arm64)
- GitHub Check: base_tests / Test (macos)
- GitHub Check: base_tests / Test (ubuntu)
- GitHub Check: build-and-test
Description
Update https://terragrunt-v1.gruntwork.io/docs/features/hooks/ to clarify that hooks give you control over exit codes. I learned about this today and couldn't find it in the docs, so hopefully this will be helpful to others!
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added docs on hook exit codes
Summary by CodeRabbit